package com.boge.study.test.design_pattern.proxy.staticproxy;

/**
 * 聚合代理
        比继承代理更适合代理模式,不需要因为代理顺序的改变而增加新的代理类
 * @author Administrator
 *
 */
public class CarTimeProxy implements MoveAbleService {
	
	private MoveAbleService m;
	
	public CarTimeProxy(MoveAbleService m) {
		super();
		this.m = m;
	}

	@Override
	public void move() {
		long startTime = System.currentTimeMillis();
		System.out.println("汽车开始行驶...");
		m.move();
		long endTime = System.currentTimeMillis();
		System.out.println("汽车结束行驶，行驶了" + (endTime - startTime) + "毫秒");
	}

}
